import request from './axios'

/**
 * 获取日志信息
 * @param data
 * @returns {Promise<AxiosResponse<any>>}
 */
export const getLogInfo = data => {
    return request.post('/logs/searchLogs',data)
}

/**
 * 获取系统日志
 * @param data
 * @returns {Promise<AxiosResponse<any>>}
 */
const initparam = {
    type:1,
    date:new Date()
};
export const sysLogs = (data = initparam) => {
    return request.post('/logs/sysLogs',data)
}
/**
 * 下载
 * @param data
 * @returns {Promise<AxiosResponse<any>>}
 */
export const downloadLog = (data = initparam) => {
    return request({
        url:'/logs/download',
        data,
        responseType: 'blob',
        method: 'post'
    })
}

/**
 * 获取日志前置参数
 * @returns {*}
 */
export const getSysInitParam = () => {
    return request({
        url:'/logs/getSysInitParam',
        method:'get'
    })
}

/**
 * 清理系统日志
 * @returns {*}
 */
export const clearSysLog = (month) => {
    return request({
        url:'/logs/clearSysLog',
        method:'get',
        params:{
            cleanTime:month
        }
    })
}

/**
 * 清理操作日志
 * @returns {*}
 */
export const clearOperaLog = (month) => {
    return request({
        url:'/logs/clearOperaLog',
        method:'get',
        params:{
            cleanTime:month
        }
    })
}
